set(QTGSTREAMER_VERSION @QTGSTREAMER_VERSION@)

@PACKAGE_INIT@

get_filename_component(_QTGSTREAMER_CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)

# include the generated QtGStreamerTargets.cmake from the same directory
find_file(_QTGSTREAMER_TARGETS_FILE @QTGSTREAMER_PACKAGE_NAME@Targets.cmake
          PATHS ${_QTGSTREAMER_CONFIG_DIR} NO_DEFAULT_PATH)
include(${_QTGSTREAMER_TARGETS_FILE})
unset(_QTGSTREAMER_TARGETS_FILE)

set(@QTGSTREAMER_PACKAGE_NAME@_FOUND TRUE)
set(QTGLIB_LIBRARY @QTGLIB_LIBRARY@)
set(QTGSTREAMER_LIBRARY @QTGSTREAMER_LIBRARY@)
set(QTGSTREAMER_QUICK_LIBRARY @QTGSTREAMER_QUICK_LIBRARY@)
set(QTGSTREAMER_UI_LIBRARY @QTGSTREAMER_UI_LIBRARY@)
set(QTGSTREAMER_UTILS_LIBRARY @QTGSTREAMER_UTILS_LIBRARY@)
set_and_check(QTGSTREAMER_INCLUDE_DIR @PACKAGE_QTGSTREAMER_INCLUDES_INSTALL_DIR@)

if (@QTGSTREAMER_PACKAGE_NAME@_FIND_QUIET)
    set(_QTGSTREAMER_FIND_DEPS_ARGS QUIET)
endif()

# Find dependencies, if not already found
if ("@QTGSTREAMER_PACKAGE_NAME@" STREQUAL "Qt5GStreamer")
    if (NOT DEFINED Qt5Core_INCLUDE_DIRS)
        if (NOT @QTGSTREAMER_PACKAGE_NAME@_FIND_QUIET)
            message(STATUS "Qt5 hasn't been found yet. Looking...")
        endif()

        find_package(Qt5Core ${_QTGSTREAMER_FIND_DEPS_ARGS})

        # import targets for linking to QtGStreamerUi, but don't fail
        # if they are not found. One may only want QtGStreamer (no Ui).
        find_package(Qt5Widgets QUIET)

        if (NOT Qt5Core_FOUND)
            set (@QTGSTREAMER_PACKAGE_NAME@_FOUND FALSE)
        endif()
    endif()
else()
    if (NOT DEFINED QT_INCLUDE_DIR)
        if (NOT @QTGSTREAMER_PACKAGE_NAME@_FIND_QUIET)
            message(STATUS "Qt4 hasn't been found yet. Looking...")
        endif()

        find_package(Qt4 COMPONENTS QtCore ${_QTGSTREAMER_FIND_DEPS_ARGS})

        if (NOT Qt4_FOUND)
            set (@QTGSTREAMER_PACKAGE_NAME@_FOUND FALSE)
        endif()
    endif()
endif()

if (NOT DEFINED Boost_INCLUDE_DIRS)
    if (NOT @QTGSTREAMER_PACKAGE_NAME@_FIND_QUIET)
        message(STATUS "Boost hasn't been found yet. Looking...")
    endif()

    find_package(Boost ${_QTGSTREAMER_FIND_DEPS_ARGS})

    if (NOT Boost_FOUND)
        set (@QTGSTREAMER_PACKAGE_NAME@_FOUND FALSE)
    endif()
endif()

unset(_QTGSTREAMER_FIND_DEPS_ARGS)

include("${CMAKE_CURRENT_LIST_DIR}/QtGStreamerConfigCommon.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/@QTGSTREAMER_PACKAGE_NAME@Targets.cmake")

# compatibility variable
set(QTGSTREAMER_FOUND ${@QTGSTREAMER_PACKAGE_NAME@_FOUND})
